package com.loser.room.cmd;

import com.loser.module.base.proto.sdk.room.RoomInfoCmd;
import com.loser.module.base.proto.sdk.room.request.RoomInfoReq;
import com.loser.module.base.proto.sdk.room.resp.RoomInfoResult;
import com.loser.room.mongo.handler.RoomHandler;
import com.loser.rpc.room.dto.resp.RoomInfoResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RoomInfoCmdHandler implements RoomInfoCmd {

    @Autowired
    private RoomHandler roomHandler;

    @Override
    public RoomInfoResult getRoomInfoCmd(RoomInfoReq req) {
        RoomInfoResp data = roomHandler.getById(req.getRoomId()).getData();
        RoomInfoResult result = new RoomInfoResult();
        result.setRoomName(data.getRoomName());
        result.setRoomId(data.getId());
        return result;
    }

}
